Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Request 的 rootDomain 获取优化 #2912

Closed
wants to merge 3 commits into from
Closed

Conversation

hongfs
Copy link
Contributor

@hongfs hongfs commented Jul 14, 2023

https://q.thinkphp.cn/post/972

通过在配置文件指定允许的公共域名后缀来避免。

config/app.php

'domain_public_suffix' => [
    'com.cn',
    'net.cn',
    'org.cn',
],

目前大多数为了精准匹配,都是使用了 https://github.com/publicsuffix/list/blob/master/public_suffix_list.dat 文件,其中涉及 ICANN 的有一万行数据,如果我们每一个请求都要读取检索那么多信息,对业务的性能也会存在影响,另外该文件也需要定期更新。最终我采用由开发者自行配置来避免。

@liu21st
Copy link
Member

liu21st commented Jul 15, 2023

其实项目的Request类里面直接设置rootDomain属性即可

@hongfs
Copy link
Contributor Author

hongfs commented Jul 16, 2023

其实项目的Request类里面直接设置rootDomain属性即可

直接设置就会硬编码了呀,后面业务调整可能就被忽略了。

@hongfs hongfs closed this Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants